/**************************************************************************************************
* Title: SimulationManager.h
* Authors: Gael Huber
* Description: Manages the actual game
**************************************************************************************************/
#ifndef __SIMULATIONMANAGER_H__
#define __SIMULATIONMANAGER_H__

#include <stdio.h>
#include <time.h>
#include <Windows.h>
#include <vector>
#include <random>

//#include "SmurfsEntity.h"
#include "SmurfsRenderManager.h"
#include "SmurfsPhysicsManager.h"
#include "SmurfsInputManager.h"
#include "SmurfsSingleton.h"
#include "SmurfsMatrixReader.h"
#include "SmurfsTerrain.h"
#include "Player.h"

#define MAX_ENTITIES 750
#define MAX_BOXES 3

class SimulationManager : public Singleton<SimulationManager> {
public:
	SimulationManager(void);	// Constructor
	~SimulationManager(void);	// Destructor

	void startUp(void);	// Initialize
	void shutDown(void);	// Shutdown

	static SimulationManager& getSingleton(void);	// Get the singleton instance
	static SimulationManager* getSingletonPtr(void);	// Get the singleton pointer

	void gameLoop(void);	// Update

	void regenPlayer(void);		// Regenerate the player and the level

	int getNumEntities(void);	// returns the number of entities in the world
	Player* getPlayer(void);		// returns the player object

	int getNumBoxes(void);		// returns the number of boxes in the world
	void addBox(void);			// creates and adds a box to the world
	void removeBox(void);		// removes the first box in the list from both lists
private:
	void createTerrain(Vector3 center);		// creates the terrain
	std::vector<Entity*> entityList;	// all entities on the screen

	// smurfs managers (singletons)
	RenderManager* renderManager;
	PhysicsManager* physicsManager;
	InputManager* inputManager;
	MatrixReader* matrixReader;
	Terrain* terrain;
	Player* player;
	
	int numEntities;		// the number of entities in the world

	std::vector<Entity*> boxes;		// the list of boxes currently in the world
	int numBoxes;			// the current number of boxes in the world
};

#endif